package org.example;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class App {
    public static void main(String[] args) {
        // 加载 Spring 配置文件，启动 IOC 容器
        ApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");

        // 从容器中获取 Product Bean
        Product product = context.getBean("product", Product.class);
        System.out.println("从IOC容器中获取的Product: " + product);

        // 从容器中获取 Student Bean
        Student student = context.getBean("student", Student.class);
        System.out.println("从IOC容器中获取的Student: " + student);
    }
}
